package org.microser.gataway.zuul.security.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.microser.gataway.zuul.security.entity.PermissionPath;
import org.microser.gataway.zuul.security.mapper.PermissionPathMapper;
import org.microser.gataway.zuul.security.service.PermissionPathService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author liujiamiao
 * @since 2020-11-26
 */
@Service
public class PermissionPathServiceImpl extends ServiceImpl<PermissionPathMapper, PermissionPath> implements PermissionPathService {

    /**
     * 获取哪些路由需要权限
     * @return
     */
    @Override
    public List<PermissionPath> getURIPermission() {
        QueryWrapper<PermissionPath> wrapper = new QueryWrapper();
        wrapper.eq("classify",1);
        wrapper.orderByAsc("sort");
        List<PermissionPath> list = list(wrapper);
        return list;
    }

    /**
     * 获取哪些路由需要过滤器
     * @return
     */
    @Override
    public List<PermissionPath> getFilterPermission() {
        QueryWrapper<PermissionPath> wrapper = new QueryWrapper();
        wrapper.eq("classify",0);
        wrapper.orderByAsc("sort");
        List<PermissionPath> list = list(wrapper);
        return list;
    }
}
